import server from './http.js' //导入axios

//首页轮播
const carousel=()=>{
   let data= server.post('/resources/carousel')
   return data
}
//登录
const login=(msg)=>{
   let data= server.post('/users/login',msg)
   return data
}
//手机区域数据
const phoneList=(msg)=>{
   let data=server.post('/product/getPromoProduct',{categoryName:msg.categoryName})
   return data
}
//家电区域
const jdList=(msg)=>{
   let data=server.post('/product/getPromoProduct',{categoryName:msg.categoryName})
   return data
}
//配件区域
const productList=(msg)=>{
   let data=server.post('/product/getPromoProduct',{categoryName:msg.categoryName})
   return data
}
//注册
const registerUser=(model)=>{
   let data=server.post('/users/register',model)
   return data
}
//详情数据
const getDetails=(res)=>{
   let data=server.post('/product/getDetails',res)
   return data
}
//详情页轮播图
const getDetailsTu=(res)=>{
   let data=server.post('/product/getDetailsPicture',res)
   return data
}
//全部商品数据
const getCategory=(res)=>{
   let data=server.post('/product/getAllProduct',res)
   return data
}
//全部商品名称
const getCategoryName=(res)=>{
   let data=server.post('/product/getCategory',res)
   return data
}
//点击商品名称切换数据
const getNameList=(res)=>{
   let data=server.post('/product/getProductByCategory',res)
   return data
}
//收藏数据
const collectList=(res)=>{
   let data=server.post('/user/collect/getCollect',res)
   return data
}
//点击喜欢添加到收藏
const  addCollect=(res)=>{
   let data=server.post('/user/collect/addCollect',res)
   return data
}
//删除收藏的商品
const deleteCollect=(res)=>{
    let data=server.post('/user/collect/deleteCollect',res)
    return data
}
//添加购物车
const AddShopCart=(res)=>{
  let data=server.post('/user/shoppingCart/addShoppingCart',res)
  return data
}
//获取全部购物车
const CartAll = (res) => {
   let data = server.post('/user/shoppingCart/getShoppingCart', res)
   return data
}
//修改购物车数量
const CartNum = (res) => {
   let data = server.post('user/shoppingCart/updateShoppingCart', res)
   return data
}
//删除 购物车
const delCart = (res) => {
   let data = server.post('/user/shoppingCart/deleteShoppingCart', res)
   return data
}
//去结算加入我的订单
const addOrder=(res)=>{
   let data=server.post('/user/order/addOrder',res)
   return data
}
//我的订单数据
const myOrder=(res)=>{
   let data=server.post('/user/order/getOrder',res)
   return data
}
export  {carousel,
   login,
   phoneList,
   jdList,
   productList,
   registerUser,
   getDetails,
   getDetailsTu,
   getCategory,
   getCategoryName,
   getNameList,
   collectList,
   addCollect,
   deleteCollect,
   AddShopCart,
   CartAll, 
   delCart,
    CartNum,
    addOrder,
    myOrder
}
